<?php
class Default_Form_CategoryItem extends Zend_Form
{

    public function init()
    {
        $this->setName("category");
        $categoryItemId = new Zend_Form_Element_Hidden('categoryItemId');
        $categoryItemId->addFilter('Int');
        
        $categoryItemName = new Zend_Form_Element_Text('categoryItemName');
        $categoryItemName->setLabel('Tên nhóm')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array( 
                                        array('NotEmpty',true,array('messages' => 'Vui lòng điền tên nhóm')),
                                        ));
        $categoryItemName->setAttrib('size', 52);
        
        $categoryItemCode = new Zend_Form_Element_Text('categoryItemCode');
        $categoryItemCode->setLabel('Mã nhóm')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array( 
                                        array('NotEmpty',true,array('messages' => 'Vui lòng điền mã nhóm')),
                                        ));
        $categoryItemCode->setAttrib('size', 52);
        
         $note = new Zend_Form_Element_Textarea('note');
        $note->setLabel('Ghi chú')->addFilter('StripTags')->addFilter('StringTrim');
        $note->setAttrib('cols', 70)->setAttrib('rows', 4);
        // submit button
        $submit = new Zend_Form_Element_Submit('submit');
        
        $submit->setAttrib('id','submitbutton');
        $submit->setAttrib('class',"button medium");
        // add elements to form
        $hash = new Zend_Form_Element_Hash('no_csrf_foo');
        $this->addElement('hash','no_csrf_foo',array (
            'salt' => 'T1EJtbLm40sRWNsj'
        ));
        $this->addElements(array ($categoryItemId, $categoryItemName, $categoryItemCode,$note, $submit));
    }
}

